#include <string>
#include "DiffTool.h"

using namespace std;
int main_cc(int argc, char *argv[]);

int main(int argc, char *argv[])
{
	try
	{
		//1st thing is to determine if Diff Functionality is needed
		bool doDiff = false;
		bool help = false;
		for (int i = 0; i < argc; i++)
		{
			string myArg (argv[i]);
			/*string::size_type myLoc = myArg.find("-d");
			if (myLoc != string::npos) {//Use Diff Functionality Flag
			*/
			if (myArg == "-d")
			{
				doDiff = true;
				break;
			}
			if ((myArg == "?" || myArg == "-help" || myArg == "/?"))
			{
				help = true;
				break;
			}
		}
		
		if (help) DiffTool::show_usage(argv[0], true);

		if (doDiff)
		{	//Run the DiffTool
			DiffTool diffToolInstance;
			diffToolInstance.DiffToolWrapper(argc, argv);
		}
		else
		{
			//If no Diff Functionality required just call the UCC
			// ------------------   Duplication Modification -----------------------
			// Passing command line arguments to check for command line  parameter 'dir'. 
			main_cc(argc, argv);
		}
	}
	catch (...)
	{
		cout << "Error: a general exception occured. Please try again." << endl;
	}
	return 0;
}
